import { errData } from '../error.js'
// 为你优选数据
export const getData = (url) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: url,
			method: 'GET'
		})
		.then(res => {
			resolve(res[1])
		})
		.catch(err => {
			errData.errlist(err)
			reject(err)
		})
	})
}

// post请求
export const postData = (url, data) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url,
			method: 'POST',
			data
		})
		.then(res => {
			resolve(res[1])
		})
		.catch(err => {
			errData.errlist(err)
			reject(err)
		})
	})
}